#include "terkexi.h"
#include "config.h"
#include <QApplication>

Terkexi::Terkexi()
{
    //初始化特尔克西图片资源
    m_Hero.load(HERO_PATH);

    //初始化坐标
    m_X = GAME_WIDTH *0.25;
    m_Y = GAME_HEIGTH *0.75;

    //初始化矩形框
    m_Rect.setWidth(m_Hero.width());
    m_Rect.setHeight(m_Hero.height());
    m_Rect.moveTo(m_X,m_Y);

    //初始化速度
    m_Vx = 0;
    m_Vy = 0;

    //初始化
    m_IsOnGround = true;
    m_WantToMoveRight = false;
    m_WantToMoveLeft = false;

    m_G = 0.45;
    m_MaxSpeed = 5;
    m_Acceleration = 0.5;
    m_Deceleration = 0.8;
    m_JumpForce = -15;
    m_AirControl = 0.4;

    //初始化二段跳
    m_JumpCount = 0;
    m_CanDoubleJump = true;

}

void Terkexi::setPosition(int x, int y)
{
    m_X = x;
    m_Y = y;
    m_Rect.moveTo(m_X,m_Y);
}

